// async1 (function* () {
//     try {
//         const ninjas = yield getJson("data/ninjas.json");
//         const missions = yield getJson(ninjas[0].missionUrl);
//         const missionDescription = yield getJson(missions[0].detailsUrl);

//     }
//     catch(e) {
//         console.log(e)
//     }
// });

// function async1(generator) {
//     var iterator = generator();
//     function handle(iteratorResult) {
//         if(iteratorResult.done) {return;}
//         const iteratorValue = iteratorResult.value;
//         if(iteratorValue instanceof Promise) {
//             iteratorValue.then(res=> handle(iterator.next(res)))
//                 .catch(err=> iterator.throw(err));
//         }
//     }

//     try{
//         handle(iterator.next());
//     }
//     catch(e){iterator.throw(e);}
// }


async function main(url) {
    try {
        const ninjas = await getJson(url);
        const missions = await getJson(ninjas[0].missionUrl);
        const missionDescription = await getJson(missions[0].detailsUrl)
        return missionDescription
    } catch (error) {
        console.log(error)
    }
}